<header class="site-header">
  <div class="container-lg clearfix">
    <%= link_to(image_tag('logo@2x.png', class: 'site-logo', alt: 'GitHub for Classrooms'), (logged_in? ? organizations_path : root_path)) %>

    <nav class="site-nav float-right  d-flex flex-wrap flex-content-start flex-justify-center">
      <%= link_to "GitHub Education", 'https://education.github.com', target: '_blank' %>

      <ul>
        <% if logged_in? %>
          <li>
            <%= link_to 'https://education.github.com/forum', class: 'tooltipped tooltipped-s', 'aria-label' => t('views.shared.community_discussion') do %>
              <%= octicon 'comment-discussion' %>
            <% end %>
          </li>

          <li>
            <%= link_to videos_path, class: 'tooltipped tooltipped-s', 'aria-label' => t('views.shared.video_tutorials') do %>
              <%= octicon 'device-camera-video' %>
            <% end %>
          </li>

          <li>
            <%= link_to 'https://github.com/education/classroom/issues/new?labels[]=report', class: 'tooltipped tooltipped-s', 'aria-label' => t('views.shared.report_bug') do %>
              <%= octicon 'bug' %>
            <% end %>
          </li>

          <li>
            <% if impersonating?(current_user, true_user) %>
              <%= link_to stop_impersonating_stafftools_user_path(current_user), class: 'tooltipped tooltipped-s', method: :delete, 'aria-label' => t('views.shared.stop_impersonating', user: current_user.github_user.login) do %>
                <div class="avatar-parent-child left">
                  <%= image_tag current_user.github_user.github_avatar_url(40), class: 'avatar', alt: "@#{current_user.github_user.login}", height: 20, width: 20 %>
                  <%= image_tag true_user.github_user.github_avatar_url(20), class: 'avatar avatar-child', alt: "@#{true_user.github_user.login}", height: 10, width: 10 %>
                </div>
              <% end %>
            <% else %>
              <%= link_to current_user.github_user.html_url, class: 'tooltipped tooltipped-s', 'aria-label' => t('views.shared.view_gh_profile') do %>
                <%= image_tag current_user.github_user.github_avatar_url(40), class: 'avatar', alt: "@#{current_user.github_user.login}", height: 20, width: 20 %>
              <% end %>
            <% end %>
          </li>

          <li>
            <%= link_to logout_path, method: :post, class: 'tooltipped tooltipped-s', 'aria-label' => t('views.shared.sign_out') do %>
              <%= octicon 'sign-out' %>
            <% end %>
          </li>

        <% else %>
          <li><%= link_to t('views.shared.sign_in'), login_path %></li>
        <% end %>
      </ul>
    </nav>
  </div>
</header>

<% if controller_path.split('/').first == 'stafftools' %>
  <div class="stafftools-border"></div>
<% end %>
